var CommonUtils = {

    // domainNamePrefix: 'http://106.12.33.172:8080/wishing-1.0',  //test net
    domainNamePrefix: 'http://121.40.119.212:8085/wishing-1.0',
    // domainNamePrefix: 'http://localhost:58080',
    loginUrl: '/wishing_front/view/share/login_password.html',
    projectUrl: "/wishing_front",

    // loginUrl: '/android_asset/www/view/share/login_password.html',
    // projectUrl: "/android_asset/www",

    // loginUrl: '/www/view/share/login_password.html',
    // projectUrl: "/www",

    downloadUrl: "https://fir.im/gs5p",
    wishingPrice: 1,
    timePrice: 10,
    jumpToLogin: function () {
        localStorage.clear();
        sessionStorage.clear();
        window.location.href = this.loginUrl;
    },
    getLocalUser: function () {
        var localuser = localStorage.getItem("user");
        if (localuser && localuser != null && typeof (localuser) != undefined) {
            return JSON.parse(localuser);
        } else {
            this.jumpToLogin();
        }
    },
    getToken: function () {
        var token = localStorage.getItem("token");
        return token;
    },
    /**
     * @description Get the parameter value according to the url
     */
    getQueryVariableFromUrl: function (variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) {
                return pair[1];
            }
        }
        return (false);
    },
    toDateString: function (date) {
        var aStrings = date.toString().split(" ");
        if (aStrings[1] == "Jan") {
            aStrings[1] = "01";
        }
        if (aStrings[1] == "Feb") {
            aStrings[1] = "02";
        }
        if (aStrings[1] == "Mar") {
            aStrings[1] = "03";
        }
        if (aStrings[1] == "Apr") {
            aStrings[1] = "04";
        }
        if (aStrings[1] == "May") {
            aStrings[1] = "05";
        }
        if (aStrings[1] == "Jun") {
            aStrings[1] = "06";
        }
        if (aStrings[1] == "Jul") {
            aStrings[1] = "07";
        }
        if (aStrings[1] == "Aug") {
            aStrings[1] = "08";
        }
        if (aStrings[1] == "Sep") {
            aStrings[1] = "09";
        }
        if (aStrings[1] == "Oct") {
            aStrings[1] = "10";
        }
        if (aStrings[1] == "Nov") {
            aStrings[1] = "11";
        }
        if (aStrings[1] == "Dec") {
            aStrings[1] = "12";
        }
        return aStrings[5] + "-" + aStrings[1] + "-" + aStrings[2] + " " + aStrings[3];
    },
    //换行修改
    //str=str.replace(/\n/g,"<br/>")
    cryptoKey: "lkqsgKHH7OkhIa0tISMtuQ==",
}
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
    history.pushState(null, null, document.URL);
});
